package com.hb.proxy.dongtai.jdk;

import java.lang.reflect.Proxy;

public class DynamicProxyDemo {

    public static void main(String[] args) {
        User realService = new RealUser();
        User proxy = (User) Proxy.newProxyInstance(
                realService.getClass().getClassLoader(),
                realService.getClass().getInterfaces(),
                new DynamicProxyHandler(realService)
        );
        proxy.run();
        proxy.eat();
    }
}
